{extend name="public:base" /}

{block name="body"}
<div class="main" style="padding:15px;">
    <div class="content">
        <span style="margin-left: 0">商品列表</span>
        <button class="layui-btn layui-btn-xs" onclick="add()">添加</button>
        <div></div>
    </div>
    <div>
        <form class="layui-form" method="post">
            <div class="layui-form-item" style="margin-top:10px;">
                <div class="layui-input-inline">
                    <select name="status">
                        <option value="-1" {if $status == -1} selected {/if}>全部</option>
                        <option value="1" {if $status == 1} selected {/if}>在售</option>
                        <option value="0" {if $status == 0} selected {/if}>下架</option>
                    </select>
                </div>
                <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i>搜索</button>
            </div>
        </form>
    </div>
    <table class="layui-table">
        <thead>
        <tr>
            <th style="text-align: center;font-weight: bold">ID</th>
            <th style="text-align: center;font-weight: bold">商品标题</th>
            <th style="text-align: center;font-weight: bold">分类</th>
            <th style="text-align: center;font-weight: bold">原价</th>
            <th style="text-align: center;font-weight: bold">折扣</th>
            <th style="text-align: center;font-weight: bold">现价</th>
            <th style="text-align: center;font-weight: bold">库存</th>
            <th style="text-align: center;font-weight: bold">状态</th>
            <th style="text-align: center;font-weight: bold">添加时间</th>
            <th style="text-align: center;font-weight: bold">操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="right" id='right'}
        <tr>
            <td style="text-align: center">{$right.id}</td>
            <td style="text-align: center">{$right.title}</td>
            <td style="text-align: center">{$right.cat|getCatName}</td>
            <td style="text-align: center">{$right.price}</td>
            <td style="text-align: center">{$right.discount}</td>
            <td style="text-align: center">
                {if $right.discount <> 0}
                {$right.discount*0.1*$right.price}
                {else/}{$right.price}
                {/if}
            </td>
            <td style="text-align: center">{$right.stock|default=0}</td>
            <td style="text-align: center">{eq name="$right.status" value="1"}<span style="color: #00FF00">在售</span>
                {else/}<span style="color:red">下架{/eq}</span></td>
            <td style="text-align: center">{$right.add_time|date='Y-m-d'}</td>
            <td>
                <button class="layui-btn layui-btn-xs" onclick="edit({$right.id})">编辑</button>
                <button class="layui-btn layui-btn-danger layui-btn-xs" onclick="del({$right.id})">删除</button>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div style="text-align: center">{$rightList|raw}</div>

</div>



{/block}